package com.example.springmvcdemo5;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Q
 * @create 2025-05-27-20:01
 */
@RequestMapping("/message")
@RestController
public class MessageController {
    private List<MessageInfo> messageInfoList = new ArrayList<>();
    @RequestMapping("/publish")
    public boolean publish(@RequestBody MessageInfo messageInfo) {
        messageInfoList.add(messageInfo);
        return true;
    }
    @RequestMapping("/getList")
    public List<MessageInfo> getList() {
        return messageInfoList;
    }
}
